package com.huang.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.huang.domain.SysConfig;
import com.huang.service.SysConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author hqy
 * @date 2022年06月21日 19:56
 */
@RestController
@RequestMapping("/sys/config")
@Api(tags = "系统配置参数")
public class ConfigController {

    @Autowired
    private SysConfigService configService;

    @GetMapping("/page")
    @ApiOperation("分页获取系统参数")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "页码",required = true,dataType = "Integer",value = "current"),
            @ApiImplicitParam(name = "条数",required = true,dataType = "Integer",value = "size")
    })
    public ResponseEntity<Page<SysConfig>> loadSysLog(
            @RequestParam("current") Integer pageNum,
            @RequestParam("size") Integer pageSize){
        Page<SysConfig> page = configService.page(new Page<>(pageNum, pageSize), null);
        return ResponseEntity.ok(page);
    }
}
